<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>添加</title>
    <#assign base=request.contextPath  />
    <base id="base" href="${base}">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, adminUser-scalable=0">
    <link rel="stylesheet" href="${base}/static/win10/component/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="${base}/static/win10/css/wangEditor.min.css" media="all">
    <script>
        var base =  "${base}";
    </script>
</head>
<body>
<br>
<form class="layui-form " action="">
         <input type="hidden" id="projectId" name="projectId" value="${wechatProject.projectId!}" >


          <div class="layui-form-item">
              <label class="layui-form-label">项目经历时间</label>
              <div class="layui-input-block">
                  <input type="text" id="projectTime" name="projectTime" value="${wechatProject.projectTime!}"  autocomplete="off" placeholder="请输入项目经历时间"
                         class="layui-input">
              </div>
          </div>


    <div class="layui-form-item">
        <label class="layui-form-label">项目经历时间选择</label>
        <div class="layui-input-block">
            <div class="layui-inline">
         <input type="text" style="width: 500px" value="${wechatProject.projectTime!}" class="layui-input datatime"
                       id="projectTimeStart"    >
            </div>

        </div>
    </div>




          <div class="layui-form-item">
              <label class="layui-form-label">项目职责</label>
              <div class="layui-input-block">
                  <input type="text" id="projectDuty" name="projectDuty" value="${wechatProject.projectDuty!}"  autocomplete="off" placeholder="请输入项目职责"
                         class="layui-input">
              </div>
          </div>


          <#--<div class="layui-form-item">-->
              <#--<label class="layui-form-label">项目描述</label>-->
              <#--<div class="layui-input-block">-->
                  <#--<input type="text" id="projectDescribe" name="projectDescribe" value="${wechatProject.projectDescribe!}"  autocomplete="off" placeholder="请输入项目描述"-->
                         <#--class="layui-input">-->
              <#--</div>-->
          <#--</div>-->


    <div class="layui-form-item">
        <label class="layui-form-label">项目描述</label>

        <div style="width: 80%" id="editors" class="layui-input-block">
            <p>${wechatProject.projectDescribe!}</p>
        </div>
    </div>



          <#--<div class="layui-form-item">-->
              <#--<label class="layui-form-label">修改时间</label>-->
              <#--<div class="layui-input-block">-->
                  <#--<input type="text" id="projectUpdateTime" name="projectUpdateTime" value="${wechatProject.projectUpdateTime!}"  autocomplete="off" placeholder="请输入修改时间"-->
                         <#--class="layui-input">-->
              <#--</div>-->
          <#--</div>-->
          <#--<div class="layui-form-item">-->
              <#--<label class="layui-form-label">创建时间</label>-->
              <#--<div class="layui-input-block">-->
                  <#--<input type="text" id="projectCreateTime" name="projectCreateTime" value="${wechatProject.projectCreateTime!}"  autocomplete="off" placeholder="请输入创建时间"-->
                         <#--class="layui-input">-->
              <#--</div>-->
          <#--</div>-->

    <div align="center">
        <button type="button" class="layui-btn" id="submit">保存</button>
    </div>
</form>

<script src="${base}/static/win10/component/layui/layui.js?t=1"></script>
<script src="${base}/static/win10/js/jquery-1.8.3.min.js?t=1"></script>
<script src="${base}/static/win10/js/wangEditor.min.js?t=1"></script>
<script>


    var E = window.wangEditor
    // console.log(window.wangEditor,'===')
    var editor = new E('#editors')
    // 或者 var editor = new E( document.getElementById('editor') )
    editor.customConfig.showLinkImg = false
    editor.customConfig.uploadImgShowBase64 = true
    editor.create()

    layui.use(['form', 'layer','laydate'], function() {

        var form = layui.form
                , layer = layui.layer;

        var laydate = layui.laydate;

        //执行一个laydate实例
        laydate.render({
            elem: '#projectTimeStart' //指定元素
            ,type: 'month'
            ,range: true //或 range: '~' 来自定义分割字符
        });



        $("#submit").on("click",function () {
            if(check()===false){
                return;
            }

            var formDate = {
                         projectId:$("#projectId").val(),
                         projectTime:$("#projectTimeStart").val(),
                         projectDuty:$("#projectDuty").val(),
                         projectDescribe:editor.txt.html()
                         // projectUpdateTime:$("#projectUpdateTime").val(),
                         //   projectCreateTime:$("#projectCreateTime").val()
            }
            $.ajax({
                type: "POST",
                url: base+"/WeChatUser/wechatProject/admin/editWechatProject",
                data: formDate,
                success: function (data) {
                    layer.msg(data.message)
                    if (data.code === 200) {
                        window.location.href=base+"/WeChatUser/wechatProject/admin/main.html"
                    } else {

                    }
                }
            });
        })







        function check(){
                   if($("#projectTime").val().length<1){
                       layer.msg("请输入项目经历时间");
                       return false;
                   }
                   if($("#projectDuty").val().length<1){
                       layer.msg("请输入项目职责");
                       return false;
                   }
                   if(editor.txt.html().length<1){
                       layer.msg("请输入项目描述");
                       return false;
                   }
                   // if($("#projectUpdateTime").val().length<1){
                   //     layer.msg("请输入修改时间");
                   //     return false;
                   // }
                   // if($("#projectCreateTime").val().length<1){
                   //     layer.msg("请输入创建时间");
                   //     return false;
                   // }
        }
    });

</script>
</body>
</html>